#include <iostream>
#include <vector>
using ll = long long;
using namespace std;

int a[41] = {
    0, 5160,9191,6410,4657,7492,1531,8854,1253,4520,9231,
    1266,4801,3484,4323,5070,1789,2744,5959,9426,4433,
    4404,5291,2470,8533,7608,2935,8922,5273,8364,8819,
    7374,8077,5336,8495,5602,6553,3548,5267,9150,3309
};

int main() {
    int n = 40;
    ll sum = 0;
    for (int i = 1; i <= n; i++) sum += a[i]; 
    ll sum_half = sum / 2;


    vector<ll> dp(sum_half + 1, 0);
    for (int i = 1; i <= n; i++) {
        for (ll j = sum_half; j >= a[i]; j--) {
            dp[j] = max(dp[j],dp[j - a[i]] + a[i]);
        }
    }

    cout << dp[sum_half] * (sum - dp[sum_half]) << endl;
    return 0;
}
